package com.offcn.service;

import com.offcn.dao.UserDao;
import com.offcn.utils.PageTool;
import com.offcn.entity.User;

import javax.servlet.http.HttpSession;
import java.util.List;

public class Userservice {
    private UserDao userDao = new UserDao();

    public boolean adminLongin(User user, HttpSession session) {
        User user1 = userDao.adminLongin(user);
        if (user1 != null) {
            session.setAttribute("user", user1);
            return true;
        }
        return false;

    }


    public List<User> findAllUser(PageTool pageTool, String search) {
        return userDao.findAllUser(pageTool, search);
    }

    public int findAllCount(String search) {
        return userDao.findAllCount(search);
    }

    public boolean addUser(User user) {
        return userDao.addUser(user) > 0;
    }

    public boolean delectUser(String uids) {
        return userDao.delectUser(uids) > 0;

    }

    public boolean updateUser(User user) {
        return userDao.updateUser(user) > 0;
    }
}
